5cee8ab8207978a78c1a52dd9aac34396c5594a1,cdap-gateway/src/test/java/co/cask/cdap/gateway/handlers/metrics/MetricsHandlerTestRun.java,MetricsHandlerTestRun,testTimeRangeQueryBatch,#,395

Before Change


        "&metric=system.reads&start=" + start + "&end="
        + end, 2, 3);

    JsonObject q1 = getSingleQueryJson(ImmutableMap.of("namespace", "yourspace", "app", "WCount1", "flow", "WCounter",
                                                       "flowlet", "splitter"),
                                       ImmutableList.of("system.reads"), ImmutableList.<String>of(),
                                       ImmutableMap.of("start", String.valueOf(start), "end", String.valueOf(end)));

    JsonObject q2 = getSingleQueryJson(ImmutableMap.of("namespace", "yourspace", "app", "WCount1", "flow", "WCounter"),
                                       ImmutableList.of("system.reads"), ImmutableList.<String>of("flowlet"),
                                       ImmutableMap.of("start", String.valueOf(start), "end", String.valueOf(end)));
    JsonArray queries = new JsonArray();
    queries.add(q1);
    queries.add(q2);
    JsonObject taggedQuery = new JsonObject();
    taggedQuery.add("timeRangeBatch", queries);

After Change


    long start = (emitTs - 60 * 1000) / 1000;
    long end = (emitTs + 60 * 1000) / 1000;

    QueryRequest query1 = new QueryRequest(getContextMap("namespace", "yourspace", "app", "WCount1",
                                                         "flow", "WCounter", "flowlet", "splitter"),
                                           ImmutableList.of("system.reads"), ImmutableList.<String>of(),
                                           ImmutableMap.of("start", String.valueOf(start), "end", String.valueOf(end)));

    QueryRequest query2 = new QueryRequest(getContextMap("namespace", "yourspace", "app", "WCount1",
                                                         "flow", "WCounter"), ImmutableList.of("system.reads"),
                                           ImmutableList.of("flowlet"),
                                           ImmutableMap.of("start", String.valueOf(start), "end", String.valueOf(end)));

    ImmutableMap<String, ImmutableList<ImmutableList<QueryResult>>> expected =